package cn.new18.testactivitytask;

import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import cn.new18.testactivitytask.activity.A;
import cn.new18.testactivitytask.activity.B;
import cn.new18.testactivitytask.activity.C;
import cn.new18.testactivitytask.activity.D;
import cn.new18.testactivitytask.activity.E;
import cn.new18.testactivitytask.activity.F;
import cn.new18.testactivitytask.activity.RxAndroidTest;


public class MainActivity extends AppCompatActivity {

    private TextView mTextView;
    private String Tag = "MainActivity";
    private TextView mChannel;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mTextView = (TextView) findViewById(R.id.file);
        mChannel = (TextView) findViewById(R.id.channel);
        mTextView.setText("Environment.getExternalStorageState() = " + Environment.getExternalStorageState());
        setChannelText();
    }

    private void setChannelText() {
        try {
            ApplicationInfo appinfo = getPackageManager().getApplicationInfo(getPackageName(), PackageManager.GET_META_DATA);
            String channel = appinfo.metaData.getString("CHANNEL");
            mChannel.setText("我来自 ：" + channel + "  BuildConfig.DEBUG : " + BuildConfig.DEBUG);

            Log.e(Tag, channel);
        }
        catch (PackageManager.NameNotFoundException e){
            e.printStackTrace();
        }
    }

    public void jumpa(View view){
        Log.e(Tag, "jumpa");
        startActivity(new Intent(this, A.class));
    }
    public void jumpb(View view){
        Log.e(Tag, "jumpb");
        startActivity(new Intent(this,  B.class));
    }
    public void jumpc(View view){
        Log.e(Tag, "jumpc");
        startActivity(new Intent(this, C.class));
    }
    public void jumpd(View view){
        Log.e(Tag, "jumpd");
        startActivity(new Intent(this, D.class));
    }
    public void jumpe(View view){
        Log.e(Tag, "jumpe");
        startActivity(new Intent(this, E.class));
    }
    public void jumpf(View view){
        Log.e(Tag, "jumpf");
        startActivity(new Intent(this, F.class));
    }
    public void jumpg(View view){
        Log.e(Tag, "jumpg");
        startActivity(new Intent(this, RxAndroidTest.class));
    }
}
